data = {"admin": "123456", "user1": "123456"}
num = 1


def login():
    print("***********************登陆页面**********************")
    print("请输入用户名！")
    username = input("用户名：")
    if username not in data.keys():
        print("提示：请输入正确的用户名！")
        login()
    else:
        print("请输入密码！")
        password = input("密码：")
        if password != data.get(username):
            print("提示：请输入正确的密码！")
            global num
            print("提示：剩余%d次机会输入密码" % (3 - num))
            if (3 - num) == 0:
                exit()
            num += 1
            login()
        else:
            sucess(username)


def sucess(st):
    print("**********************登陆成功************************")
    print("欢迎%s回来！" % st)
    print("******************************************************")


login()
















